<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/3/14
 * Time: 11:17
 */

namespace App\Http\Controllers\Admin;


use App\Http\Logics\CommonLogic;
use App\Http\Traits\CommonTrait;
use App\Http\Controllers\BaseController;
class CommonController extends BaseController
{
    use CommonTrait;

    /**
     * 上传图片
     * @return mixed
     */
    public function uploadPhoto()
    {
        $photo_file = $this->photo_file;
        $data = [
            'photo_file' => $photo_file
        ];
        $response = CommonLogic::uploadPhoto($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return json_encode(array('files' => ['file' => $response->data->file, 'url' => $response->data->url]));
    }
}